<?php

class Migration_CreateOAuthClientsTable extends CI_Migration
{
	public function up()
	{
		$this->dbforge->add_field([
			'client_id' => [
				'type' => 'varchar',
				'constraint' => 80,
				'null' => false,
			],
			'client_secret' => [
				'type' => 'varchar',
				'constraint' => 80
			],
			'redirect_uri' => [
				'type' => 'varchar',
				'constraint' => 512,
				'null' => false,
			],
			'grant_type' => [
				'type' => 'varchar',
				'constraint' => 80,
			],
			'scope' => [
				'type' => 'varchar',
				'constraint' => 100
			],
			'user_id' => [
				'type' => 'varchar',
				'constraint' => 80,
			]
		])
		->add_key('client_id', true)
		->create_table('oauth_clients');
	}

	public function down()
	{
		$this->dbforge->drop_table('oauth_clients', true);
	}
}